package cn.chenxing.domain.dbscan;

import lombok.Data;

/**
 * @Description 用于DBSCAN分析
 * @Author maogen.ymg
 * @Date 2020/4/17 21:17
 */
@Data
public class Point {
    /**
     *  经度
     */
    private double x;
    /**
     * 纬度
     */
    private double y;
    /**
     * 是否被遍历
     */
    private boolean isVisited;
    /**
     * 簇
     */
    private int cluster;
    /**
     * 是否噪音点
     */
    private boolean isNoised;
    // --------用于展示-------
    /**
     * 用户ID
     */
    private long userId;

    public Point(double x,double y, long userId) {
        this.x = x;
        this.y = y;
        this.isVisited = false;
        this.cluster = 0;
        this.isNoised = false;
        this.userId = userId;
    }

    public double getDistance(Point point) {
        return Math.sqrt((x-point.x)*(x-point.x)+(y-point.y)*(y-point.y));
    }
}
